package com.lianzhihui.romeex.mvp.presenter;

import android.content.Context;

import com.lianzhihui.romeex.bean.EcologicalBean;
import com.lianzhihui.romeex.bean.MnnerTransferListBean;
import com.lianzhihui.romeex.mvp.model.NodeBuyModelImp;
import com.lianzhihui.romeex.mvp.model.NodeBuyModelInterface;
import com.lianzhihui.romeex.mvp.view.NodeBuyView;

//逻辑实现
public class NodebuyPresnterImp implements NodeBuyModelInterface {

    private final NodeBuyView viewLayer;
    private final NodeBuyModelImp modelImp;

    public NodebuyPresnterImp(Context context, NodeBuyView viewLayer) {
        this.viewLayer = viewLayer;
        modelImp = new NodeBuyModelImp(context, this);
    }

    public void requestMinnerMyBalance() {
        modelImp.requestMinnerMyBalance();
    }

    /**
     * 1积分记录 2转账记录
     *
     * @param page
     * @param pageSize
     */
    public void requestMinnerTransferList(int page, int pageSize, String type) {
        modelImp.requestMinnerTransferList(page, pageSize, type);
    }

    /**
     * 节点购买
     *
     * @param type
     */
    public void requestMinnerBuyNode(String type) {
        modelImp.requestMinnerBuyNode(type);
    }

    @Override
    public void onFailure() {
        viewLayer.setFailure();
    }

    @Override
    public void responseMinnerTransferListSuccess(MnnerTransferListBean b) {
        viewLayer.responseMinnerTransferListSuccess(b);
    }

    @Override
    public void responseMinnerBuyNodeSuccess() {
        viewLayer.responseMinnerBuyNodeSuccess();
    }

    @Override
    public void responseMinnerMyBalanceSuccess(EcologicalBean b) {
        viewLayer.responseMinnerMyBalanceSuccess(b);
    }


}
